Repository navigation
Scroll and sharpen PDFs and images, reorder tabs, adopt Mac shortcuts, fix a fuzz crash, and release 0.3.3 - #32
Merged
Merged
Conversation
The guest fuzz targets build the guest natively, with yrs's debug assertions on, but their crashes went to folders that only crates/collab-sandbox/tests/fuzz.rs replays, through the module the app runs, which has none. An input that trips one of those assertions replayed clean there, so its regression case could never fail. The guest's own tests now replay the record and writer_record folders through the harness the guest targets run. The records those inputs become move to fuzz/inputs.rs, which the sandbox, that harness and the guest's test all include, so a kept input builds the same record in each.
The guest's strict lib0 reader took any struct whose info byte has 10 in its low five bits as a skip. yrs 0.26.0 takes only the byte 10 as one and decodes any other such byte as an item of content kind 10, so yrs read fields the reader never checked. The guest_writer_record fuzz target found such a record in Actions run 45420270988: a skip with the parent-sub flag on, which yrs read as an item whose parent names a client ID past 2^53. That tripped yrs's debug assertion in ClientID::new. The app's module has no debug assertions. There yrs masks the client ID and reads on until the record fails to parse, which an item of content kind 10 always does, so every device already judged the record unreadable as yrs_parse. The reader now refuses such a byte itself, with the same code, before yrs sees it. No record changes verdict. A record with a flagged skip can report yrs_parse where it reported another code before, such as foreign_client for a skip under another client ID. The new module is a protocol change. Its BLAKE3 hash goes from 474fc8ff67264921721d966cab76ebae7f5d0b24684b80c7c0be769b2cb43b6e to af0b819e9ea890878d979e8d7b6361c049ea8cd1dcc3251f4fc3d2beef4cb7ae, and the near-limit fixtures keep their fuel. The collaboration fixture adds a flagged skip, §22 states the rule, and the fuzz input joins the writer_record regressions.
…request The repository doesn't let GitHub Actions create pull requests, so the nightly Fuzz run failed at gh pr create after it pushed the crashing inputs. The job now pushes the branch and writes a compare link to the job summary, from which someone opens the pull request, which also starts its CI. It drops the pull-requests permission, notes in the summary when a failed run left no input to keep, and still fails on a crash.
tall.pdf holds a page 612 by 14,000 points of numbered text lines, the shape of a web page saved as PDF, and a Letter page after it. The new render test opens it in a window at two pixels a point and prints each PDF texture's size against the size the page shows at. On the current viewer the page shows 840 points wide from a texture 179 pixels wide, about a tenth of the 1,680 pixels the screen needs: MAX_SIDE caps the page's longest side at 4,096 pixels, and the page's height takes the whole budget.
A PDF tab now lays its pages out one under the other and scrolls through them, as Preview does. The page switcher leaves the toolbar; Thumbnails, zoom, Fit width and Find in PDF stay. A thumbnail, a match and a link to page N scroll the view to that page, and a match on a tall page scrolls to its line. Once you click the pages, Page Up, Page Down, Space, the arrows, Home and End scroll them. Each page draws in tiles of at most 2,048 by 1,024 pixels, at the zoom times the screen's pixels per point, and the view puts each tile pixel on a screen pixel. The old viewer fit a whole page in 4,096 pixels on its longest side, so a page 14,000 points tall showed 848 points wide from 179 pixels on a 2x screen. It now shows from 1,696. app-core lays the pages out, follows the page at the middle of the view, and asks the PDF's thread for the tiles that show, then those within a view's height of them. The thread draws up to four tiles of a column in one pass over the page. The tab forgets tiles more than two views away, keeps at most 256 MB of tiles beside those that show, and keeps at most 240 thumbnails. A thumbnail of a tall page fits 200 points tall instead of drawing 4,096 pixels. Zoom, Fit width and a new width at Fit width keep what shows at the middle of the view in place. Tiles drawn at the old zoom stay under the new ones until those cover the view.
A tab took only clicks, so a drag that started on one fell through to the title bar row under it, and the row moved the window. A tab now takes its own drags. While you drag one along the row, a line marks the gap it drops into; the empty part after the last tab puts it last, and Escape cancels. A click, a double-click, a middle-click and the close button work as before, and the row's empty part still moves the window. app-core moves the tab and saves the order with the rest of the window's tabs, so it comes back at the next launch. A moved preview tab stays the preview, and the next preview replaces it where it now sits. The drag carries its window's viewport, since windows share egui's drag payload and number their tabs from zero each. On macOS a drag near the top of the row still moved the window, through AppKit rather than egui. The next commit stops that.
A Noura window runs its content under a transparent title bar, so the tab row sits in the band where AppKit moves the window. AppKit moves it on a drag that starts there when the view under the pointer answers yes to mouseDownCanMoveWindow, and winit's view keeps NSView's answer, which is yes for a view that isn't opaque. With tab dragging in place, a drag on a tab near the top of the row still moved the window, and the tab bar never saw it. The desktop shell gives winit's view class an answer of no, once, from the first window's view. AccessKit swaps each view's class for a subclass of its own, which inherits it. The shell finds winit's class as the one that subclasses NSView directly, adds the method without replacing one, and logs a warning if the class already has its own. The empty parts of the row still move the window through StartDrag, as on Windows and Linux.
A double-click on the title bar row's empty part always zoomed the window, whatever you chose under Desktop & Dock, "Double-click a window's title bar to". app-ui now records the double-click for its window, and the desktop shell does the action after the frame. On macOS the shell reads AppleActionOnDoubleClick, as Chromium does: Maximize zooms, Fill fills the screen through AppKit's _zoomFill: when the window answers it, Minimize minimizes, and None or a value it doesn't know does nothing. Unset, it falls back to the older AppleMiniaturizeOnDoubleClick flag, then to zoom. It acts on the key window, which the double-click's first click made key. Windows and Linux maximize or restore the window, as before. A double-click on a tab keeps the tab and leaves the window alone.
The tab bar widened its window-moving area 8 points to the left, over the sidebar's resize edge, and egui registered it after the edge, so it won there. In the top 36 points, a drag just right of the divider moved the window, and the pointer showed no resize cursor. The area now starts where the edge ends while the sidebar shows, so the edge resizes the sidebar in the title bar row as it does below it.
An icon drew centred in its rect, so a rect a fractional width wide put its corner between pixels. Tabs share the row in fractional widths, so every other tab's close button started half a pixel in, and the GPU spread each texture pixel over two screen pixels, which made the icon softer and dimmer than its neighbour's. icons::paint now sizes the square from the texture's own pixels and rounds its corner to the nearest screen pixel, for every icon it draws. An icon moves by under half a pixel at most.
Tabs shrank no narrower than 160 points, then ran past the row's end with no scroll bar and no other way to find them: 14 tabs in a 1,000-point window showed four whole. Tabs now shrink to 100 points, as in Safari and VS Code, before the row scrolls. A trackpad or a mouse wheel scrolls it, still with no scroll bar. While the tabs don't all fit, a button at the row's end lists every one, as Obsidian's tab list and Chrome's tab search do; picking one activates it and scrolls it into sight, even when it was already active. The active tab also scrolls back into sight when the row's width changes and when a tab closes, as in VS Code, instead of only when it changes. 14 tabs in a 1,000-point window now show six whole. A tab dragged within 48 points of either end of a row that scrolls scrolls it that way, faster nearer the end, as in Chrome and Safari, so it can drop anywhere along the row. Over the list button it drops at the end of the part that shows. The tab list's accessibility bounds are now the part of the row that shows.
The thumbnails panel highlighted the page that shows but left it where it was, so End or a jump to page 250 put the highlight out of sight. When the page that shows changes, or the pages jump for a match, a link, a zoom or Fit width, the panel now scrolls the least it can to show that page's thumbnail whole, as Preview's sidebar does. Opening the panel shows it too. Between those, you can scroll the panel anywhere and it stays put.
An embed drew its page once, 1,200 pixels wide, and the note scaled that picture to fit. A web page saved as one long PDF page shrank to a sliver, and any page blurred on a 2x screen. A page no taller than A4 for its width still lays out as an image does. A taller one lays out as wide as an A4 page would and runs past the bottom of the view at its own shape. Each PDF that notes embed gets the thread a PDF tab uses, which reads the file once and draws the part of the page in view in tiles, one pixel for each of the screen's. Tiles more than two views away go, the embeds of every note keep at most 64 MB of tiles beside those that show, and a PDF lets its thread and tiles go 30 seconds after the last ask or when its last note closes. Each frame frees the textures of tiles that didn't draw.
A pinch did nothing over a PDF, and Command-= zoomed the whole interface, which shrank a page at Fit width. A pinch over the pages, or Command and the scroll wheel, now zooms them smoothly to any size from 25% to 400%, keeping the place under the pointer where it is. The tiles drawn before stretch until the pinch rests for 150 ms, then the tab draws the new size, so the window uploads no textures mid-pinch. While a PDF tab is active, Zoom In, Zoom Out and Actual Size zoom the PDF, as in Preview: Command-= and Command-minus step its zoom and Command-0 shows the pages at their own size. Anywhere else they zoom the interface. One function in app/commands.rs makes that choice. The interface zoom leaves a page's size on the screen alone. A tab measures its zoom against the screen's own points, so a page at 100% stays 1,224 pixels wide on a 2x screen at a 125% interface zoom, from the same tiles. Fit width still fills the tab.
app-core reads the density a PNG records in its pHYs chunk and a JPEG in its JFIF header or Exif data, as Preview does. A Retina screenshot saved at 144 dpi shows at half its pixel size; 72 dpi, no density, or an implausible one shows at a point a pixel. An image tab now keeps a zoom: Fit by default, which shrinks the image to the tab and never enlarges it, as Preview, Safari and VS Code open an image, or a magnification. Zoom In and Zoom Out step through the PDF tab's levels, extended to 5% and 1,600%, and stop at Fit on the way past it. Actual Size shows the image at 100%. A pinch magnifies it and keeps the point under the pointer in place; the keys keep the middle of the view. The client reports the image's size, its view and the interface zoom each frame, and app-core says where to scroll. As in a PDF tab, the interface zoom leaves the image's size on the screen alone: the tab measures its magnification against the screen's own points, and a new interface zoom keeps the middle of the view in place. Fit still fills the tab. App::zoom_view, which already chose between the PDF tab and the interface, now zooms the image while an image tab is active.
The editor now takes an embed's size in points. A note image keeps its size beside the text when you zoom with Command-= or move the window between a Retina and a 1x screen. It used to divide pixels by the screen's pixels per point, so zooming in shrank images and a 1x screen doubled them. Images show at the size Preview gives them: a raster image at the density its file records, and an SVG at its declared size. A Retina screenshot on a Retina screen lays out as before. An image with no density now shows at a point a pixel, and an SVG declared 400 by 300 shows at 400 by 300 points instead of 200 by 150. The note measures an SVG without drawing it at 1x, and draws it at the screen's pixels. ScaledTextureLoader replaces FittingTextureLoader. It uploads each raster image at the pixels it covers on the screen, scaled down on a thread with a Lanczos filter, since egui-wgpu samples a single level and an image drawn smaller skips pixels into moiré. A grid of 1-pixel lines drawn 1.5 to 4 times smaller turns an even gray. The last size drawn stands in while a new one scales. Each image keeps the sizes of the last two passes, and egui keeps at most 256 MB of decoded images to scale from. PDF embeds keep their size: their pixel sizes now convert to points where the note reports them.
…ke Preview The image tab shows the image at the size Preview gives it, so a Retina screenshot no longer opens at twice its size. It asks for the pixels the image covers on the screen: an SVG draws sharp at 2x, and a large photo uploads only the pixels it shows. The tab opens fit to the window, and scrolls once you zoom past it. A pinch or a Command-scroll zooms at the pointer. Command-=, Command-minus and Command-0 zoom the image while its tab is active; on any other tab they still zoom the interface, which leaves the image's size on the screen alone, as it does a PDF page's. The image sits on a screen pixel with a whole number of pixels across, at least one. On the frame that applies a zoom's scroll, the scroll area turns off its rubber band, which would otherwise pull the new offset back toward the previous frame's bounds.
Keys and menu items reach what covers the window first. Close Tab closes Settings or search, the way Close shuts a Settings window on macOS. Over a dialog that asks something, Close Tab and Close Window wait for its answer, as they do while a macOS sheet shows. Commands that act on tabs and files wait under any of them; Quit, zoom and New Window still run.
Cmd+1 to Cmd+8 show that tab and Cmd+9 the last one, as in Safari, Chrome, VS Code and Obsidian, with Ctrl on Windows and Linux. Search doesn't list these; the shortcuts page shows them as two lines. The rail's pages move to Ctrl+Cmd+1 to 9 on macOS, the keys Safari gives its sidebars, and to Alt+1 to 9 on Windows and Linux. Cmd+Option and a digit stay with the note's headings, and Cmd+Option+8 with macOS zoom. Next Tab and Previous Tab also answer to Cmd+Option+Right and Left on macOS and to Ctrl+Page Down and Page Up elsewhere, as in Chrome. The default keymap now depends on the platform, so Command::new starts without keys and the kernel adds its own.
Each press brings back the tab you closed before the last one it reopened, in its old place among the tabs and where you were in it, as in Safari, Chrome, VS Code and Obsidian. A window remembers its last 20 closed tabs, as VS Code does, and keeps them in its saved view state, so they come back after a relaunch. A closed tab follows its file when it moves; one whose file is gone or that is open again is skipped. File > Reopen Closed Tab runs it too.
Cmd+W with no tab open closes the window, as in Safari and Chrome. On Windows and Linux, closing the last window quits Noura as before. On macOS Noura now stays open without windows, as Safari and Preview do. The last window closes its tabs, which Cmd+Shift+T can reopen, and hides while the workspace stays open. A click on Noura in the Dock, a later launch or a menu item shows it again; New Window shows it rather than opening a second one. winit doesn't report Dock clicks, so the desktop answers the reopen Apple event itself.
On macOS, Return on a row of the file tree starts renaming it, and Cmd+Down or Cmd+O opens a file or opens and closes a folder, as in Finder and VS Code. F2 still renames. On Windows and Linux Enter opens and F2 renames, as in Explorer. The keymap for the tree moves into app-core, so the shortcuts page and the tree read the same keys.
Within a row and a half of the tree's top or bottom edge, a dragged row, or files dragged in from the file manager, scroll the tree toward that edge: slowly as the pointer enters the band, up to 1,200 points a second at the edge or past it, as Finder does. You can now drop into a folder that was scrolled out of view. The tree also gives screen readers its bounds.
Search filtered to names or contents now says how many files it found and lists them 50 at a time, the next 50 once you scroll near the end of the list or press Down on its last row, as VS Code's lists do. Unfiltered, a group that leaves files out ends with Show all and its count, as Spotlight's Show More does; choosing it filters search to that group and keeps what you typed. Ranking by name keeps every match instead of the first 50. The contents search fetches one page at a time through a new offset in local-core, and counts every match in a second query that runs once the first page is on its way, so the first results never wait for the count. A new search drops a count still to come.
Zoom In, Zoom Out and Actual Size zoom the PDF or image of the active tab only while you can see it. While Settings or search covers it, they zoom the interface, as they do in a note. A test also checks that the tab Cmd+1 to 9, Cmd+Option+arrows and Cmd+Shift+T go to comes into sight when the tab row overflows.
The DMG window shows Noura's icon, a lavender arrow and the Applications folder on a near-black background, with a lavender glow in the upper right. Finder draws each icon's label in dark text, so light pills sit under the two labels. The colors come from the website's palette. packaging/dmg-background.svg holds the design. scripts/render-dmg-background.sh renders it at 1x and 2x into dmg-background.tiff, and cargo-packager copies that TIFF into the image. The window measures 640 by 432 points with its title bar, which leaves a 640 by 400 content area on macOS 26 and later.
cargo-packager passes --skip-jenkins to create-dmg when CI is "true", and that flag skips the Finder script that writes the background, icon positions and window size into the image's .DS_Store. GitHub Actions sets CI, so the DMGs from CI and the release would open as a plain window. package-desktop.sh now unsets CI for cargo-packager on macOS, since GitHub's macOS runners run Finder. check-desktop-packages.sh fails a DMG whose .DS_Store lacks the background, the window bounds, the icon size or the icon positions.
The image lost its license agreement in 0.3.2, when apps/desktop/Cargo.toml dropped license-file, but the check still fed hdiutil a stream of "yes" and said the image carried one. hdiutil now mounts the image as is, and an image that gains an agreement again fails the check at the mount.
live-tests compiles app-ui's tests/it/support module by path. That module gained images.rs, which writes PNGs through `image`, and live-tests had no such dependency, so `cargo clippy --workspace --all-targets` and the workspace's nextest build stopped at live_note.
This version scrolls PDFs, draws PDFs and images at the screen's density, reorders tabs by drag, follows Mac keyboard conventions and opens the disk image in a laid-out window.
On Linux and Windows the pages' view is 6 pt wider, so fit width draws larger pages and page 1 drops its tiles while page 3 shows. The test checked page 1 right after Home, before it drew again.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR collects the work since 0.3.2 and sets the version to 0.3.3. It fixes a crash the nightly fuzzer found, rebuilds the PDF viewer, reworks tabs in the title row, draws images at the screen's density, adopts Mac keyboard conventions, and lays out the DMG window.
Fuzz crash in the collaboration sandbox
The nightly fuzzer found that the guest's lib0 reader took any info byte whose low five bits are 10 as a skip. yrs treats only the byte 10 itself as a skip, so on such a record yrs decoded a client ID the guest hadn't checked.
yrs_parsebefore yrs sees them (36c3f32). This changes the pinned module: its BLAKE3 hash goes from474fc8ff…toaf0b819e…, and the pin, a new fixture case and §22 are updated. Every record keeps its verdict from 0.3.2; only the refusal code on these malformed records can differ. The shipped 0.3.2 module already judged the crashing input unreadable, with no trap.fuzz.ymlno longer opens a pull request, which this repo doesn't allow Actions to do. It pushes the regression branch and links it from the run summary (44a3016).PDF viewer
Tabs and the title row
_zoomFill:, as Chromium does, and falls back to Zoom.Images
Keyboard
DMG window
The disk image opens as a dark 640×400 window: the app, an arrow, and the Applications folder, with a 1x and 2x background.
package-desktop.shunsetsCIon macOS, because cargo-packager otherwise skips the Finder step that writes the layout.check-desktop-packages.shfails a DMG without that layout.Testing
On macOS, every CI step passed locally on this branch:
cargo nextest run --workspace --profile ci: 4,298 passedcargo denycheck-desktop-packages.shon a packaged DMGA release build passed these checks in a real window:
Not verified locally:
module,fuzz,release)After the merge, tag
v0.3.3onmainto publish it.